str_replace
search
The value being searched for, otherwise known as the needle. An array may be used to designate multiple needles.
replace
The replacement value that replaces found search values. An array may be used to designate multiple replacements.
Dvs. at man henholdsvis kan lede og erstatte flere værdier vha. et array.
Du kan se eksemplet her:
- $phrase = "You should eat fruits, vegetables, and fiber every day.";
- $healthy = array("fruits", "vegetables", "fiber");
- $yummy = array("pizza", "beer", "ice cream");
-
- $newphrase = str_replace($healthy, $yummy, $phrase);
Indlæg senest redigeret d. 16.09.2014 19:11 af Bruger #18836